package controleur;

import javax.swing.JLabel;
import javax.swing.JSlider;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;

import model.ThreadEnvironnement;

public class Vitesse implements ChangeListener{

	private ThreadEnvironnement t = null;
	private JLabel lab = null;
	
	public Vitesse(ThreadEnvironnement t, JLabel labelValeur) {
		this.t = t;
		this.lab = labelValeur;
	}
	@Override
	public void stateChanged(ChangeEvent e) {
		if(e.getSource().getClass() != JSlider.class)
			return;
		JSlider j = (JSlider) e.getSource();
		int value = j.getValue();
		t.setTempsPause(value);
		lab.setText(value + " ms");
	}

}
